import React, { Component } from 'react'

export default class App extends Component {

  constructor(props) {
    super(props)
    this.state = {
      username: "yz",
      password: "123",
      modify: "123"
    }
  }

  render() {
    return (
      <div>
        <form onSubmit={e => { this.handleSubmit(e) }}>
          <label htmlFor="username">
            <input type="text"
                   id='username'
                   name='username'
                   onChange={e => this.handleUsernameChange(e)}
                   value={this.state.username} />
          </label>
          <br />
          <label htmlFor="password">
            <input type="text"
                   id='password'
                   name='password'
                   onChange={e => this.handlePasswordChange(e)}
                   value={this.state.password} />
          </label>
          <br />
          <label htmlFor="modify">
            <input type="text"
                   id='modify'
                   name='modify'
                   onChange={e => this.handleModifyChange(e)}
                   value={this.state.modify} />
          </label>
          <br />
          <input type="submit" value="提交"/>
        </form>
      </div>
    )
  }
  handleSubmit(event) {
    event.preventDefault()

    console.log(this.state.fruit)

  }

  handleChange(event) {
    this.setState({
      [event.target.name]: event.target.value
    })
  }
}
